#include <iostream>
using namespace std;

int main() {
    int n,total = 0;
    int number = 0;
    cin >> n;

    for (int i = 0; i < n; i++)
    {
        cin >> number;
        int ge = number % 10;
        int shi = number % 100 / 10;
        int bai = number / 100 % 10;
        int qian = number / 1000;
        if (ge - qian - bai - shi > 0)
        {
            total++;
        }
    }
    cout << total;
    
    
    return 0;
}